<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="swiper-5.4.5/package/css/swiper.css">
    <script src="swiper-5.4.5/package/js/swiper.js"></script>
    <style>
        .swiper-container {
            width: 600px;
            height: 300px;

        }

       
        .a{
            background:red;
        }
        .b{
            background:green;
        }
        .c{
            background:yellow;
        }
        .d{
            background:purple;
        }
        .e{
            background:skyblue;
        }
        .f{
            background:hotpink;
        }
    </style>
</head>

<body>

    <!-- 如果是6版本之前需要使用的swiper-container -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide a">Slide 1</div>
            <div class="swiper-slide b">Slide 2</div>
            <div class="swiper-slide c">Slide 3</div>
            <div class="swiper-slide d">Slide 4</div>
            <div class="swiper-slide e">Slide 5</div>
            <div class="swiper-slide f">Slide 6</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>


    </div>

    <script>
        var mySwiper = new Swiper('.swiper-container', {

            //前进后退按钮
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
            // autoplay:true,//自动播放
            autoplay: {
                delay: 1000,//1秒轮播1次
                stopOnLastSlide: true,//是否停留在最后一个滑块上
                disableOnInteraction: true,//操作过滑块后是否自动播放
            },
            //如果需要分页器
            pagination: {
                el: '.swiper-pagination',
                clickable :true,//分液器可点击
            },
            loop:true,//循环模式
            // direction:"vertical",//水平(horizontal)和垂直方向(vertical)播放
            // slidesPerView:3,//当前显示的滑块的个数
            // effect : 'cube',
        });    
    </script>
</body>

</html>